package cn.org.escience.controller;

import cn.org.escience.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 毕子航 951755883@qq.com
 * @date 2018/06/22
 */
@RequestMapping(value = "/users")
@RestController
public class UserController2 {

	@Value("${discovery.eureka.instance.hostname}")
	String title;

	@GetMapping(value = "/{userId}")
	public Object get(@PathVariable("userId") String userId) {
		if (StringUtils.hasText(userId)) {
			User build = User.builder().id(userId).password("password2").username("username2").build();
			return build;
		}
		return null;
	}
}
